<?php

declare (strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */
namespace App\Model;

class AccessToken extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected ?string $table = 'access_token';
    /**
     * 获取有效的access_token
     * @return AccessToken|\Hyperf\Database\Model\Builder|\Hyperf\Database\Model\Model|object|null
     */
    public static function active()
    {
        return static::where('expiration_time', '>', date('Y-m-d H:i:s'))->first();
    }
}